<?
//print_r($count);
?>
<? $addressbook_found = count($addressbook); ?>
<form action="<?=base_url()?><?=get_segment(1)?>/<?=get_segment(2)?>/" method="post">
    <div class="bill_name" id="bill_name" data-role="fieldcontain">
        <fieldset data-role="controlgroup">
            <label for="bill_name">
                {bill_Name}
            </label>
            <input name="name" id="bill_name" placeholder="{bill_Name}" value="<?=set_value('name')?>" type="text" />
            <?php echo form_error('name', '<div class="form_error">', '</div>'); ?>
        </fieldset>
    </div>
    <div class="from_bank" id="from_bank" data-role="fieldcontain">
        <fieldset data-role="controlgroup">
            <label for="from_bank">
                {from_bank}
            </label>
            <input name="from_bank" id="from_bank" placeholder="{from_bank}" value="<?=set_value('from_bank')?>" type="text" />
            <?php echo form_error('from_bank', '<div class="form_error">', '</div>'); ?> 
        </fieldset>
    </div>
    <div class="to_bank" id="to_bank" data-role="fieldcontain">
        <label for="to_bank">
            {to_bank}
        </label>
        <?= form_dropdown('to_bank', get_bank_list(), set_value('to_bank'), 'id="to_bank" name="to_bank" data-theme="b"') ?>
       <?php echo form_error('to_bank', '<div class="form_error">', '</div>'); ?>     
    </div>

    <div class="account_number" id="account_number" data-role="fieldcontain">
        <fieldset data-role="controlgroup">
            <label for="account_number">
                {account_number}
            </label>
            <input name="accound_number" id="account_number" placeholder="{account_number}" value="<?=set_value('accound_number')?>" type="text" />
             <?php echo form_error('accound_number', '<div class="form_error">', '</div>'); ?>
        </fieldset>
    </div>
    <div class="trans_type" id="trans_type" data-role="fieldcontain">
        <fieldset data-role="controlgroup">
            <label for="trans_type">
                {trans_type}
            </label>
            <input name="trans_type" id="trans_type" placeholder="{trans_type}" value="<?=set_value('trans_type')?>" type="text" />
            <?php echo form_error('trans_type', '<div class="form_error">', '</div>'); ?>
        </fieldset>
    </div>
    <div class="trans_date" id="trans_type" data-role="fieldcontain">
        <fieldset data-role="controlgroup">
            <label for="trans_date">
                {trans_date}
            </label>
            <input name="trans_date" id="trans_date" placeholder="{trans_date}" value="<?=set_value('trans_date')?>" type="datetime" />
            <?php echo form_error('trans_date', '<div class="form_error">', '</div>'); ?>
        </fieldset>
    </div>    
    <div>{Cash Must trans : } <?=number_format($invoices['Total'])?> {Rial}</div>
    <div class="Cashe" id="Cashe" data-role="fieldcontain">
        <fieldset data-role="controlgroup">
            <label for="Cashe">
                {Cashe}
            </label>
            <input name="cashe" id="Cashe" placeholder="{Cashe}" value="<?=set_value('cashe')?>" type="text" />
            <?php echo form_error('cashe', '<div class="form_error">', '</div>'); ?>
        </fieldset>
    </div>
   
    <?
    if ($addressbook_found > 0) {
        ?>
        <div class="addressbook" id="addressbook" data-role="collapsible-set" data-theme="b" data-content-theme="c">
            <div data-role="collapsible" data-collapsed="false">
                <h3>
                    {Reciver Address}
                </h3>
                <ul data-role="listview" data-filter="true"  style="padding: 0px;">
                    <?
                    foreach ($addressbook as $val) {
                        ?>
                    <li class="view_addressbook">
                        <div  ><input  style="left: 0;"  type="radio" name="addressbook" value="<?=set_value('addressbook',$val->id)?>" <? if($val->default == 'YES'){ echo ' checked="checked"';} ?> /></div>
                            
                             <div><?=$val->name?></div>
                             <div><?=$val->city?></div>
                             <div><?=$val->mobile?></div>
                             <div><?=$val->address?></div>

                        </li>
                        <?
                    }
                    ?>
                </ul>
            </div>


            <input class="Pay" id="Pay" data-theme="b" data-icon="plus" data-iconpos="right" value="{Pay}" type="submit" />
            <?
        } else {
            ?>
            <a href="<?= base_url() ?>/addressbook/add" class="Pay" data-role="button" data-theme="b" data-icon="plus" data-iconpos="right" value="{Pay}">
                {click here to add address book chooe address book}

            </a>
            <?
        }
        ?>
</form>